 <script>
      
      $(function () {
	  Reload();
          $("#Btn_Sub").click(function () {
              var data = $("#MT4ID").val();
              var type = $("#selected").val();
                      if (data != null && data != undefined && type != null && type != undefined && type != -1) {
                          $.ajax({
                              type: 'GET',
                              url: '/AddMasterList',
                              data: { 'data': data ,'type':type},
                              success: function (e) {
                                 if(e=='true') {
                                     alert("添加成功！");
                                     //异步刷新
                                     Reload();
                                 }else {
                                     alert(e);
                                 }
                                }
              });
              }
          });
      });
	  
	  function Reload() {
        $.ajax({
            type: 'GET',
            url: '/GetMasterList',
            success: function (e) {
               if(e!=null){
								//先清空
								$("#Tb").find("tr").remove();
							　　for(var model in e){ 
								$("#Tb").append('<tr> <td>'+e[model]["name"]+'</td> <td>'+e[model]["desc"]+'</td>  <td><a href="#" class="btn btn-danger btn-sm btn-icon icon-left" onclick="Remove('+e[model]["mt4_id"]+')">Delete</a></td> </tr>');
								} 
						}
            }
        });
    }
	
	function Remove(param){
		 $.ajax({
            type: 'GET',
            url: '/RemoveMasterList?id=' + param,
            success: function (e) {
                if (e == 'true') {
                    alert("成功删除！");
                    Reload();
                } else {
                    //添加失败
                    alert(e);
                }
            }
        });
	}
    </script>
			
	<a href="javascript:;" onclick="jQuery('#modal-4').modal('show', {backdrop: 'static'});$('.modal-backdrop fade in').remove()" class="btn btn-primary btn-single btn-sm">Show Me</a>


			
			
	
<div class="panel panel-default panel-border">
						<div class="panel-heading">
							高手推荐管理
						</div>
						
						<div class="panel-body">
							
														<label class="col-sm-2 control-label" for="field-1"></label>
<input type="text" class="form-control" id="MT4ID" value="点击添入mt4id..." onfocus="if(value == '点击添入mt4id...') { value = '' }" onblur="if (value == '') { value = '点击添入mt4id...'}">
									<select class="form-control" id="selected">
										<option value="-1">选择推荐类型</option>
											<option value="0">短期投资</option>
											<option value="1">长期投资</option>
											<option value="2">最多复制</option>
											<option value="3">最多盈利</option>
										</select>
										<button class="btn btn-white btn-block" id="Btn_Sub">提交</button>
									</div>
							
						</div>
					
					
					<div class="panel panel-color panel-white"><!-- Add class "collapsed" to minimize the panel -->
						<div class="panel-heading">
							<h3 class="panel-title">高手推荐列表</h3>
							
							<div class="panel-options">
								<a href="#">
									<i class="linecons-cog"></i>
								</a>
								
								<a href="#" data-toggle="panel">
									<span class="collapse-icon">&ndash;</span>
									<span class="expand-icon">+</span>
								</a>
								
								<a href="#" data-toggle="reload">
									<i class="fa-rotate-right"></i>
								</a>
								
								<a href="#" data-toggle="remove">
									&times;
								</a>
							</div>
						</div>
						
						<div class="panel-body">
							
														<table class="table table-model-2 table-hover">
										<thead>
											<tr>
												<th>用户名</th>		
												<th>推荐类型</th>
												<th>操作</th>
											</tr>
										</thead>
										
										<tbody id="Tb">
										
										</tbody>
									</table>
									
									
			
						</div>
					</div>

								
								


							
					
				




						

